package com.sysman.HttpTools;
/** 
* @author  LTT-AH-ZY
* @date 创建时间：2017年9月14日 上午10:06:48 
* @version 1.0 
* @parameter 参数及其意义
* @since 最早使用该方法/类/接口的JDK版本 
* @since  
* @return  
*/

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONObject;

public class DataAnalyze {
	/**
	 * @作用 对http返回的json数据进行解析，返回的是map格式的数据
	 * @param jsonarray
	 * @return
	 */
	public static List<Map<String, String>> JsonToList(JSONArray jsonarray){
		List<Map<String, String>> list = new ArrayList<>();
		for(int i=0;i<jsonarray.length();i++){
			Map<String,String> map = new HashMap<>();
        	JSONObject job = jsonarray.getJSONObject(i);
        	map.put("id", job.get("hospdeptid").toString());
        	map.put("name", job.get("hospdeptname").toString());
        	list.add(map);
        	System.out.println("----数据："+job) ;
        }
		return list;
	}
	/**
	 * 病人端注册列表解析类，对传输接收的json信息进行解析
	 * @param jsonarray
	 * @return
	 */
	public static List<Map<String, Object>> PatientJsonToList(JSONArray jsonarray){
		List<Map<String, Object>> list = new ArrayList<>();
		for(int i=0;i<jsonarray.length();i++){
			Map<String,Object> map = new HashMap<>();
        	JSONObject job = jsonarray.getJSONObject(i);
        	map.put("userloginid", job.get("userloginid").toString());//病人登陆id
        	map.put("username", job.get("username").toString());//病人姓名
        	map.put("usermale", job.get("usermale").toString());//病人性别
        	map.put("userloginphone", job.get("userloginphone").toString());//病人手机号码
        	map.put("userlogintype", job.get("userlogintype").toString());//病人账户类型id
        	map.put("userlogintypename", job.get("userlogintypename").toString());//病人账户类型名
        	map.put("usercardnum", job.get("usercardnum").toString());//病人身份证号码
        	list.add(map);
        	//System.out.println("----数据："+job) ;
        }
		return list;
	}
	/**
	 * 医生端注册列表解析类，对传输接收的json信息进行解析
	 * @param jsonarray
	 * @return
	 */
	public static List<Map<String, Object>> DoctorJsonToList(JSONArray jsonarray){
		List<Map<String, Object>> list = new ArrayList<>();
		for(int i=0;i<jsonarray.length();i++){
			Map<String,Object> map = new HashMap<>();
        	JSONObject job = jsonarray.getJSONObject(i);
        	map.put("dochosp", job.get("dochosp").toString());//医生所在医院
        	map.put("doclogintypename", job.get("doclogintypename").toString());//医生注册状态名
        	map.put("doclogintype", job.get("doclogintype").toString());//医生注册状态字
        	map.put("docloginid", job.get("docloginid").toString());//医生登陆id
        	map.put("dochuanxinaccount", job.get("dochuanxinaccount").toString());//医生环信账号
        	map.put("docloginphone", job.get("docloginphone").toString());//医生登陆手机
        	map.put("docmale", job.get("docmale").toString());//医生性别
        	map.put("docname", job.get("docname").toString());//医生姓名
        	map.put("doctitle", job.get("doctitle").toString());//医生职称
        	list.add(map);
        	//System.out.println("----数据："+job) ;
        }
		return list;
	}
	/**
	 * 医院端注册列表解析类，对传输接受的json信息进行解析
	 * @param jsonarray
	 * @return
	 */
	public static List<Map<String, Object>> HospitalJsonToList(JSONArray jsonarray){
		List<Map<String, Object>> list = new ArrayList<>();
		for(int i=0;i<jsonarray.length();i++){
			Map<String,Object> map = new HashMap<>();
        	JSONObject job = jsonarray.getJSONObject(i);
        	map.put("hosplogintypename", job.get("hosplogintypename").toString());//医院端注册状态名
        	map.put("hosplogintype", job.get("hosplogintype").toString());//医院端注册状态字
        	map.put("hospname", job.get("hospname").toString());//医院名
        	map.put("hosploginid", job.get("hosploginid").toString());//医院端登陆id
        	map.put("hosplevelname", job.get("hosplevelname").toString());//医院等级名
        	map.put("hosphuanxinaccount", job.get("hosphuanxinaccount").toString());//医院端环信账号
        	map.put("hosploginphone", job.get("hosploginphone").toString());//医院端登陆手机
        	map.put("hosploginpix", job.get("hosploginpix").toString());//医院端头像路径
        	list.add(map);
        	//System.out.println("----数据："+job) ;
        }
		return list;
	}
	/**
	 * 部门审核列表解析类，对传输接受的json信息进行解析
	 * @param jsonarray
	 * @return
	 */
	public static List<Map<String,Object>> HospDeptJsonToList(JSONArray jsonarray){
		List <Map<String,Object>> list = new ArrayList<>();
		for(int i=0;i<jsonarray.length();i++) {
			Map<String,Object> map = new HashMap<>();
			JSONObject job = jsonarray.getJSONObject(i);
			map.put("hospdeptid", job.get("hospdeptid").toString());
			map.put("hospdeptname", job.get("hospdeptname").toString());
			map.put("hospfatherdeptnameischeck", job.get("hospfatherdeptnameischeck").toString());
			map.put("hospdeptfatherid", job.get("hospdeptfatherid").toString());
			map.put("hospfatherdeptname", job.get("hospfatherdeptname").toString());
			map.put("hospdeptischeck", job.get("hospdeptischeck").toString());
			list.add(map);
		}
		return list;
	}
	/**
	 * 获取需要退款的医生列表的json转list
	 * @param jsonarray
	 * @return
	 */
	public static List<Map<String,Object>> DcotorfundJsonToList(JSONArray jsonarray){
		List <Map<String,Object>> list = new ArrayList<>();
		for(int i=0;i<jsonarray.length();i++) {
			Map<String,Object> map = new HashMap<>();
			JSONObject job = jsonarray.getJSONObject(i);
			map.put("docloginid", job.get("docloginid").toString());
			map.put("dochosp", job.get("dochosp").toString());
			map.put("docalipayaccount", job.get("docalipayaccount").toString());
			map.put("docalipayname", job.get("docalipayname").toString());
			map.put("dochuanxinaccount", job.get("dochuanxinaccount").toString());
			map.put("docloginphone", job.get("docloginphone").toString());
			map.put("docmale", job.get("docmale").toString());
			map.put("docloginpix", job.get("docloginpix").toString());
			map.put("docname", job.get("docname").toString());
			map.put("doctitle", job.get("doctitle").toString());
			map.put("docpursebalance", job.get("docpursebalance").toString());
			list.add(map);
		}
		return list;
	}
	/**
	 * 获取需要退款的医院列表的json转list
	 * @param jsonarray
	 * @return
	 */
	public static List<Map<String,Object>> HospitalfundJsonToList(JSONArray jsonarray){
		List <Map<String,Object>> list = new ArrayList<>();
		for(int i=0;i<jsonarray.length();i++) {
			Map<String,Object> map = new HashMap<>();
			JSONObject job = jsonarray.getJSONObject(i);
			map.put("hosploginid", job.get("hosploginid").toString());
			map.put("hospname", job.get("hospname").toString());
			map.put("hosppursebalance", job.get("hosppursebalance").toString());
			map.put("hosplevelname", job.get("hosplevelname").toString());
			map.put("hosphuanxinaccount", job.get("hosphuanxinaccount").toString());
			map.put("hosploginphone", job.get("hosploginphone").toString());
			map.put("hosploginpix", job.get("hosploginpix").toString());
			map.put("hospalipayaccount", job.get("hospalipayaccount").toString());
			map.put("hospalipayname", job.get("hospalipayname").toString());
			list.add(map);
		}
		return list;
	}
	/**
	 * 获取需要退款的医院列表的json转list
	 * @param jsonarray
	 * @return
	 */
	public static List<Map<String,Object>> PatientfundJsonToList(JSONArray jsonarray){
		List <Map<String,Object>> list = new ArrayList<>();
		for(int i=0;i<jsonarray.length();i++) {
			Map<String,Object> map = new HashMap<>();
			JSONObject job = jsonarray.getJSONObject(i);
			map.put("userorderhprice", job.get("userorderhprice").toString());
			map.put("userordertotaldeposit", job.get("userordertotaldeposit").toString());
			map.put("userorderchosehosptime", job.get("userorderchosehosptime").toString());
			map.put("userorderid", job.get("userorderid").toString());
			map.put("userorderleavehosptime", job.get("userorderleavehosptime").toString());
			map.put("familyname", job.get("familyname").toString());
			map.put("usersickpic", job.get("usersickpic").toString());
			map.put("userorderhospseconddept", job.get("userorderhospseconddept").toString());
			map.put("familyage", job.get("familyage").toString());
			map.put("userorderactualhospitalizationid", job.get("userorderactualhospitalizationid").toString());
			map.put("actualhospitalizationstatename", job.get("actualhospitalizationstatename").toString());
			map.put("userorderhospconfirmtime", job.get("userorderhospconfirmtime").toString());
			map.put("userorderstatename", job.get("userorderstatename").toString());
			map.put("userorderhospprimarydept", job.get("userorderhospprimarydept").toString());
			map.put("userorderdocloginid", job.get("userorderdocloginid").toString());
			map.put("userorderdeposit", job.get("userorderdeposit").toString());
			map.put("familymale", job.get("familymale").toString());
			map.put("docname", job.get("docname").toString());
			map.put("userorderstateid", job.get("userorderstateid").toString());
			list.add(map);
		}
		return list;
	}
	/**
	 *  反馈信息列表json转list
	 * @param jsonarray
	 * @return
	 */
	public static List<Map<String,Object>> FeedBackJsonToList(JSONArray jsonarray){
		List <Map<String,Object>> list = new ArrayList<>();
		for(int i=0;i<jsonarray.length();i++) {
			Map<String,Object> map = new HashMap<>();
			JSONObject job = jsonarray.getJSONObject(i);
			map.put("feedbackid", job.get("feedbackid").toString());
			map.put("feedbackidea", job.get("feedbackidea").toString());
			map.put("feedbacktime", job.get("feedbacktime").toString());
			map.put("feedbackischeck", job.get("feedbackischeck").toString());
			map.put("feedbacktype", job.get("feedbacktype").toString());
			map.put("feedbackchecktime", job.get("feedbackchecktime").toString());
			list.add(map);
		}
		return list;
	}
	/**
	 * 退款信息列表json转list
	 * @param jsonarray
	 * @return
	 */
	public static List<Map<String,Object>> DrawBackJsonToList(JSONArray jsonarray){
		List <Map<String,Object>> list = new ArrayList<>();
		for(int i=0;i<jsonarray.length();i++) {
			Map<String,Object> map = new HashMap<>();
			JSONObject job = jsonarray.getJSONObject(i);
			map.put("dochosp", job.get("dochosp").toString());
			map.put("userorderid", job.get("userorderid").toString());
			map.put("familyname", job.get("familyname").toString());
			map.put("usersickpic", job.get("usersickpic").toString());
			map.put("userorderprice", job.get("userorderprice").toString());
			map.put("doctitle", job.get("doctitle").toString());
			map.put("familyage", job.get("familyage").toString());
			map.put("userorderstatename", job.get("userorderstatename").toString());
			map.put("userorderptime", job.get("userorderptime").toString());
			map.put("familymale", job.get("familymale").toString());
			map.put("docname", job.get("docname").toString());
			map.put("userorderstateid", job.get("userorderstateid").toString());
			map.put("userorderetime", job.get("userorderetime").toString());
			list.add(map);
		}
		return list;
	}
}
